{% load i18n %}
{% load static %}
{% load simpletags %}

<el-aside width="auto" class="menu">
  <div class="logo-wrap" v-if="!fold">
    <div class="logo">
      {% if "SIMPLEUI_LOGO"|get_config %}
        <img src="{{ "SIMPLEUI_LOGO"|get_config }}" alt="home-logo">
      {% else %}
        <img src="{% static '/admin/simpleui-x/img/logo.png' %}" alt="home-logo">
      {% endif %}
    </div>
    <div class="title">
      <span>{{ site_header }}</span>
    </div>
  </div>

  <div class="logo-wrap-fold" v-if="fold">
    <div class="logo">
      {% if "SIMPLEUI_LOGO"|get_config %}
        <img src="{{ "SIMPLEUI_LOGO"|get_config }}" alt="home-logo">
      {% else %}
        <img src="{% static '/admin/simpleui-x/img/logo.png' %}" alt="home-logo">
      {% endif %}
    </div>
  </div>

  <el-menu unique-opened="true" default-active="1" :default-active="menuActive" :collapse="fold">
    <div v-for="(item,i) in menus" :key="item">
      <el-menu-item v-if="!item.models" :index="(i+1)+''" @click="openTab(item,(i+1)+'')">
        <i :class="item.icon"></i>
        <span v-if="menuTextShow" slot="title" v-text="item.name"></span>
      </el-menu-item>
      <el-submenu v-else :index="(i+1)+''">
        <template slot="title">
          <i :class="item.icon"></i>
          <span v-if="menuTextShow" slot="title" v-text="item.name"></span>
        </template>

        <el-menu-item-group v-for="(sub,j) in item.models" :title="sub.name" :key="sub.name">
          <el-menu-item :index="(i+1)+'-'+j" @click="openTab(sub,(i+1)+'-'+j)">
            <i :class="sub.icon"></i>
            <span slot="title" v-text="sub.name"></span>
          </el-menu-item>
        </el-menu-item-group>
      </el-submenu>
    </div>
  </el-menu>

</el-aside>